const xlsx = require("node-xlsx");
const path = require("path");
const uuid = require("uuid");

const customer = require("../Customer")

// 导入客户
const customerData = xlsx.parse(path.join( __dirname, "..", "..", "xlsx", "customer.xlsx" ))[0].data;
const arr = [];
for(let i=1; i<customerData.length; i++){
  arr.push({
    cId: 'customer-'+uuid.v1(),
    cName: customerData[i][0]
  })
}
customer.insertMany( arr ).then(()=>{
  console.log('客户导入成功');
})